package com.lantosec.hmrp.modules.category.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lantosec.hmrp.modules.category.entity.AssetsPrintLog;
import com.lantosec.hmrp.modules.category.mapper.AssetsPrintLogMapper;
import com.lantosec.hmrp.modules.category.service.IAssetsInfoService;
import com.lantosec.hmrp.modules.category.service.IAssetsPrintLogService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * <p>
 * 资产标签打印日志 服务实现类
 * </p>
 *
 * @author AutoCode
 * @since 2020-04-09
 */
@Service
@Primary
@Log4j2
public class AssetsPrintLogServiceImpl extends ServiceImpl<AssetsPrintLogMapper, AssetsPrintLog> implements IAssetsPrintLogService {

    @Autowired
    private IAssetsInfoService infoService;

    @Override
    public void create(AssetsPrintLog entity) {
        entity.setPrintUser("管理员");
        entity.setPrintUserId("superuser");
        entity.setPrintTime(new Date());
        baseMapper.insert(entity);
        //保存打印信息至资产信息表
        baseMapper.updateInfo(entity.getAssetsId(),entity.getPrintUser(),entity.getPrintUserId(),entity.getPrintTime());
    }
}
